<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>发货计划信息</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<jsp:include page="${pageContext.request.contextPath }/resource_path.jsp" flush="true"/>
</head>
<body class="layui-anim layui-anim-up">
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a>
          <cite>BOM</cite>
        </a>
      </span>
    </div>
    <div class="x-body">
      <div style="margin-bottom: 18px">
		<div class="layui-inline">
			<table>
				<tr>
					<td>
						<div class="layui-input-block" style="width:200px;margin-left: 0px;margin-top: 0px;">
							<select class="layui-input" name="keyword01" id="keyword01" lay-verify="required"  lay-filter="forwardingunit">
								<option value="">请选择车型</option>
								<c:forEach items="${products}" var="product">
									<option value="${product.id}">${product.productNumber}</option>
								</c:forEach>
							</select>
						</div>
					</td>
					<td>
						<input class="layui-input" name="keyword02" id="keyword02" placeholder="请输入版本" autocomplete="off" style="display: inline; width: 180px; margin-left: 10px"> 
					</td>
					<td>
						<div class="layui-input-block" style="width:200px;margin-left: 0px;margin-top: 0px;margin-left: 10px">
							<select class="layui-input" name="keyword03" id="keyword03">
								<option value="">请选择启用状态</option>
								<option value="1">是</option>
								<option value="0">否</option>
							</select>
						</div>
					</td>
				</tr>
			</table>
		</div>
		<button class="layui-btn layui-btn-normal" data-type="reload"><i class="layui-icon">&#xe615;</i>检索</button>
	  </div>
      <xblock>
			<%-- <button id="test1" class="layui-btn layui-btn-blue"><i class="layui-icon layui-icon-upload"></i>导入</button>
			<a id="download" href="${pageContext.request.contextPath }/excel/excelTemplate.do?title=BOM模板" class="layui-btn layui-btn-blue"><i class="layui-icon layui-icon-file-b"></i>下载模板</a> --%>
			<button id="add" class="layui-btn layui-btn-warm"><i class="layui-icon"></i>新增</button>
			<button id="dels" class="layui-btn layui-btn-danger"><i class="layui-icon layui-icon-delete"></i>批量删除</button>
      </xblock> 
	  <table class="layui-hide" id="tableList" lay-filter="tableList"></table>
	  <table class="layui-hide" id="tableDetails1" lay-filter="tableDetails1"></table>
	</div>
	<script type="text/html" id="rowToolbar">
		<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
		<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
		<a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="upState"><i class="layui-icon layui-icon-ok-circle"></i>启用</a>
	</script>
	<script type="text/html" id="productAddRowToolbar">
		<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="proDel"><i class="layui-icon layui-icon-delete"></i>删除</a>
	</script>
	<!-- 产品选择框 -->
	<div id="productDiv" hidden="hidden">
		<form class="layui-form">
			<table id="productTable"></table>
            <button class="layui-btn layui-btn-blue" lay-submit lay-filter="productform" style="margin: 0px 0px 10px 200px; width: 500px">提交</button>
		</form>
	</div>

	<div id="addDivID" hidden="hidden">
		<form class="layui-form" id="addFormID">
			<xblock>
				<table style="margin-left: 85px;">
					<tr>
						<td>
							<label class="layui-form-label">车型</label></td>
						<td>
							<div class="layui-input-block" style="width:200px;margin-left: 0px;margin-top: 0px;">
								<select class="layui-input" name="productId" id="productId" lay-verify="required"  lay-filter="forwardingunit">
									<option value="">请选择车型</option>
									<c:forEach items="${products}" var="product">
										<option value="${product.id}">${product.productNumber}</option>
									</c:forEach>
								</select>
							</div>
							<span class="xing" style="margin-left: 101%;"></span>
						</td>
						<td>
							<label class="layui-form-label">版本</label></td>
						<td>
							<input class="layui-input" id="version" name="version" style="width: 200px" placeholder="请输入版本">
							<input type="hidden" id="id" name="id">
						</td>
					</tr>
					<tr style="height:20px">
					</tr>
				</table>
			</xblock>
			<table id="productAddTable" lay-filter="productAddTable"></table>
			<xblock style="margin-top: -8px;padding-bottom: 8px;">
				<button class="layui-btn layui-btn-blue" id="subBtn" lay-submit lay-filter="addForm" style="margin-left:40%; margin-bottom: 10px;margin-top: 12px;">立即提交</button>
				&emsp;&emsp;&emsp;&emsp;
				<button class="layui-btn layui-btn-primary" style="margin-bottom: 10px;margin-top: 12px;">取消</button></td>
				<!-- <button type="reset" class="layui-btn layui-btn-primary" style="margin-bottom: 10px">重置</button> -->
			</xblock>
			</table>
		</form>
    </div>

	<script type="text/javascript">
        var table;
		layui.use(['table','layer','upload','form','laydate'], function(){
			table = layui.table;
			var layer = layui.layer;
			var form = layui.form;
			var upload = layui.upload;
			
			var laydate = layui.laydate;
			var $ = layui.jquery, active = {
				reload:function () {
					var keyword01 = $.trim($("#keyword01").val());
	                var keyword02 = $.trim($("#keyword02").val());
	                var keyword03 = $.trim($("#keyword03").val());
					table.reload('tableList',{
						method:'get'
						,where:{
							productId:keyword01
	                        ,version:keyword02
	                        ,state:keyword03
						}
						,page: {
		                    curr: 1//重新从第 1 页开始
		                }
					});
				}
			}
			$('.layui-btn').on('click', function(){
				var type = $(this).data('type');
				active[type] ? active[type].call(this) : '';
			});
			
			//指定允许上传的文件类型
            upload.render({
                elem: '#test1'
                ,url: '${pageContext.request.contextPath }/StorageAreaManager/upload.do'
                ,accept: 'file' //普通文件
                ,exts: 'xls|xlsx' //只允许上传Excel文件
                ,field:'file'
                ,method: 'POST'
                ,done: function(res){
                    console.log(res)
                    if (res >0) {
                        toastr.success('导入成功！');
                    }else {
                        toastr.error('导入失败！');
                    }
                    setTimeout(function(){  //使用  setTimeout（）方法设定定时1000毫秒
                    	window.location.reload();
                    },1000);
                }
                ,error: function(){//请求异常回调
                    toastr.error('网络异常，请稍后重试！');
                }
            });
			
			var url = '${pageContext.request.contextPath }/bom/list.do'
			table.render({
				elem: '#tableList'
				,url:url
				,toolbar: '#toolbar'
				,title: 'machineList'
				,limits:[10,20,30]
                ,defaultToolbar:['filter', 'print']
				,request: {   //如果无需自定义请求参数，可不加该参数
	                pageName: 'page' //页码的参数名称，默认：page
	                ,limitName: 'pageSize' //每页数据量的参数名，默认：limit
	            }
	            ,response: {   //如果无需自定义数据响应名称，可不加该参数
	                countName: 'total' //规定数据总数的字段名称，默认：count
	                ,dataName: 'rows' //规定数据列表的字段名称，默认：data
	            }
				,cols: [
		                [{
		                    type: 'checkbox',
		                    fixed: 'left'
		                }, {
		                	field:'id',
		                	title:'序号', 
		                	sort: true,
		                	width: 60,
		                	type:'numbers',
		                	align:'center'
		                }, {
		                    field: 'id',
		                    title: 'id',
		                    hide:true //是否初始隐藏列，默认：false。layui 2.4.0 新增
		                } , {
		                    title: '车种',
		                    align:'center',
		                    templet: function(d){
		                    	var value = "";
            	    			if(d.product !=null){
            	    				value = d.product.productName
            	    			}
            	    			return value;
            	    		} 
		                } , {
		                    title: '车型',
		                    align:'center',
		                    templet: function(d){
		                    	var value = "";
            	    			if(d.product !=null){
            	    				value = d.product.productNumber
            	    			}
            	    			return value;
            	    		} 
		                }, {
		                    field: 'version',
		                    title: '版本',
		                    align:'center',
		                } , {
		                    field: 'state',
		                    title: '是否启用',
		                    align:'center',
		                    templet: function(d){
		                    	var value = "否";
            	    			if(d.state == "1"){
            	    				value = "是"
            	    			}
            	    			return value;
            	    		} 
		                }, {
		                    fixed: 'right',
		                    title:'操作',
		                    toolbar: '#rowToolbar',
		                    align:'center',
		                    unresize: true,
		                    //width: 200 
		                }
		                ]
		               ]
				,page: true
				,done : function(){
	                $('th').css({
	                    'background-color': '#009688', 'color': '#fff','font-weight':'bold',
	                    //'font-size': 10,
	                })
	            }
			});
			var tableData=new Array(); // 用于存放表格数据
        	table.render({
                elem: '#productAddTable'
                ,data:tableData
                ,defaultToolbar:['filter', 'print']
        		,cols: [
                    [{
                        field: 'id',
                        title: 'id',
                        hide:true //是否初始隐藏列，默认：false。layui 2.4.0 新增
                    }, {
                    	field:'id',
                    	title:'序号', 
                    	sort: true,
                    	width: 60,
                    	type:'numbers',
                    	align:'center'
                    } , {
                    	field: 'bomId',
                        title: 'id',
                        hide:true 
                    }, {
                        title: '供应商',
                        align:'center',
                       	templet: function(d){
	                    	var value = "";
           	    			if(d.materiel != null){
           	    				value = d.materiel.customer_name
           	    			}
           	    			return value;
           	    		}
                    } , {
                    	field: 'materiel_name',
                    	title: '物料名称',
                        align:'center',
                       	templet: function(d){
   	                    	var value = "";
           	    			if(d.materiel != null){
           	    				value = d.materiel.materiel_name
           	    			}
           	    			return value;
           	    		}
                    } , {
	                    title: 'SAP/QAD',
	                    align:'center',
	                   	templet: function(d){
	                    	var value = "";
	       	    			if(d.materiel != null){
	       	    				value = d.materiel.materiel_num
	       	    			}
	       	    			return value;
	       	    		}
                    }, {
                        field: 'quantity',
                        title: '数量',
                        align:'center'
                        ,edit: 'text'
                    }, {
                    	fixed: 'right',
                    	title:'<a onclick="addProduct()"><i class="layui-icon layui-icon-search" style="font-size: 13px; color: #1E9FFF;"></i>查找带回</a>',
                    	toolbar: '#productAddRowToolbar',
                    	align:'center',
                    	unresize: true,
                    	width:100
                    }
                 ]]
            	,limit:Number.MAX_VALUE
    	        ,page: false
    	        ,height: 423
    	        ,done : function(){
	                $('th').css({
	                    'background-color': '#009688', 'color': '#fff','font-weight':'bold',
	                    //'font-size': 10,
	                })
	            }
            });
        	//表格
            table.render({
                elem: '#tableDetails1'
                ,url:'${pageContext.request.contextPath }/bomDetail/list.do?bomId=-1'                
                ,title: '发货计划详细表'
                ,limits:[10,20,30]
                ,defaultToolbar:['filter', 'print']
                ,request: {   //如果无需自定义请求参数，可不加该参数
                    pageName: 'page' //页码的参数名称，默认：page
                    ,limitName: 'pageSize' //每页数据量的参数名，默认：limit
                }
                ,response: {   //如果无需自定义数据响应名称，可不加该参数
                    countName: 'total' //规定数据总数的字段名称，默认：count
                    ,dataName: 'rows' //规定数据列表的字段名称，默认：data
                } 
                ,cols: [
                    [{
                        field: 'dpdid',
                        title: 'id',
                        hide:true //是否初始隐藏列，默认：false。layui 2.4.0 新增
                    }, {
                    	field:'id',
                    	title:'序号', 
                    	sort: true,
                    	width: 60,
                    	type:'numbers',
                    	align:'center'
                    } , {
                        title: '供应商',
                        align:'center',
                       	templet: function(d){
	                    	var value = "";
           	    			if(d.materiel != null){
           	    				value = d.materiel.customer_name
           	    			}
           	    			return value;
           	    		}
                    } , {
                    	title: '物料名称',
                        align:'center',
                       	templet: function(d){
   	                    	var value = "";
           	    			if(d.materiel != null){
           	    				value = d.materiel.materiel_name
           	    			}
           	    			return value;
           	    		}
                    } , {
	                    title: 'SAP/QAD',
	                    align:'center',
	                   	templet: function(d){
	                    	var value = "";
	       	    			if(d.materiel != null){
	       	    				value = d.materiel.materiel_num
	       	    			}
	       	    			return value;
	       	    		}
                    }, {
                        field: 'quantity',
                        title: '数量',
                        align:'center',
                        //edit: 'text'
                    }
                    ]]
                ,page: true
                ,done : function(){
	                $('th').css({
	                    'background-color': '#009688', 'color': '#fff','font-weight':'bold',
	                    //'font-size': 10,
	                })
	            } 
                ,height: 300
            });
        	
			
	        table.on('row(tableList)', function(obj){
	        	table.reload('tableDetails1',{
						url:'${pageContext.request.contextPath }/bomDetail/list.do?bomId='+obj.data.id
						,method:'get'
						,page: {
			                curr: 1//重新从第 1 页开始
			            }
        	  	});
	        	
	        	if(obj.checked == true && obj.type == 'all'){
	                //点击全选
	                $('.layui-table-body table.layui-table tbody tr').addClass('layui-table-click');
	            }else if(obj.checked == false && obj.type == 'all'){
	                //点击全不选
	                $('.layui-table-body table.layui-table tbody tr').removeClass('layui-table-click');
	            }else if(obj.checked == true && obj.type == 'one'){
	                //点击单行
	                if(obj.checked == true){
	                    obj.tr.addClass('layui-table-click');
	                }else{
	                    obj.tr.removeClass('layui-table-click');
	                }
	            }else if(obj.checked == false && obj.type == 'one'){
	                //点击全选之后点击单行
	                if(obj.tr.hasClass('layui-table-click')){
	                    obj.tr.removeClass('layui-table-click');
	                }
	            }
	        });
	        
			//监听行工具事件
			table.on('tool(productAddTable)', function(obj){
				var data = obj.data;
				var tr = obj.tr; //获得当前行 tr 的DOM对象
				//单个删除
				if(obj.event === 'proDel'){
				  layer.confirm('确定删除吗？', function(index){
					  //obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
					  var oldData =  table.cache["productAddTable"];
					  var i = oldData.indexOf(data)
					  oldData.splice(i,1)
		              table.reload('productAddTable',{
		            	  data : oldData
		              });
					  layer.close(index);
				  });
				}
			});
			//监听行工具事件
			table.on('tool(tableList)', function(obj){
				var data = obj.data;
				//alert(data.id)
				var idArr = new Array();
				//单个删除
				if(obj.event === 'del'){
				  layer.confirm('确定删除吗？', function(index){
					var id = obj.data.id;
					$.ajax({
						type:'post',
						url:'${pageContext.request.contextPath }/bom/delete.do',
						data:{ "ids" : id },
						success:function(data){
							if(data > 0){
								toastr.success("删除成功！");
								setTimeout(function(){
									location.reload();
								},1000);
							}else{
								toastr.warning("删除失败！");
								setTimeout(function(){
									location.reload();
								},1000);
							}
						}
					});
					layer.close(index);
				  });
				} else if(obj.event === 'upState'){
					  layer.confirm('启用后同一产品其他版本禁用，确定启用吗？', function(index){
						var id = obj.data.id;
						var productId = obj.data.productId;
						$.ajax({
							type:'post',
							url:'${pageContext.request.contextPath }/bom/upState.do',
							data:{ "id" : id ,"productId":productId},
							success:function(data){
								if(data > 0){
									toastr.success("启用成功！");
									setTimeout(function(){
										location.reload();
									},1000);
								}else{
									toastr.warning("启用失败！");
									setTimeout(function(){
										location.reload();
									},1000);
								}
							}
						});
						layer.close(index);
					  });
				} else if(obj.event === 'edit'){
					layer.open({
					  type: 1 							//Page层类型
					  ,area: ['1200px', '640px'] 	//宽  高
					  ,title: '编辑'
					  ,shade: 0.6 						//遮罩透明度
					  ,maxmin: true 					//允许全屏最小化
					  ,anim: 1 							//0-6的动画形式，-1不开启
					  ,content: $('#addDivID')
	                  ,end: function () {
	                      var formDiv = document.getElementById('addDivID');
	                      formDiv.style.display = '';
	                  }
	                  ,success: function(){
	                      $("#id").val(data.id)
	                      $("#productId").val(data.productId)
	                      $("#version").val(data.version)
                      	  var newData = new Array();
	                      $.ajax({
	                        type:'post',
	                        data:'bomId='+data.id,
	                        url:'${pageContext.request.contextPath}/bomDetail/queryAllByMution.do',
	                        dataType: 'JSON',
	                        async: false,
	                        success:function (data) {
	                        	newData = data;
	                        }
	                      }); 
	                      table.reload('productAddTable',{
	        	              data : newData
	        	          });
	                      form.render();
	                    }
					});
				}
			});

			/**
			 * 通用表单提交(AJAX方式)(新增)
			 */
			form.on('submit(productform)', function (data) {
				var oldData =  table.cache["productAddTable"];
				var checkStatus = table.checkStatus('productTable')
	      		var data = checkStatus.data;
				var num = 0;
				for (var i = 0; i < data.length; i++) {
					var ii = 0
					for (var j = 0; j < oldData.length; j++) {
						if(oldData[j].materiel.id == data[i].id){
							ii++;
							break;
						}
					}
					if(ii == 0){
						var datan = {materiel:data[i],quantity:0}
		            	oldData.push(datan);
					}else{
						num++;
					}
	            }
	            table.reload('productAddTable',{
	            	data : oldData
	            });
	            layer.close(productIndex)
	            if(num > 0){
	            	toastr.warning("有"+num+"条数据重复不能添加");
				}
				return false;
			});
			/**
			 * 通用表单提交(AJAX方式)(新增)
			 */
			form.on('submit(addForm)', function (data) {
				var index = layer.load(1, {
	        	    shade: [0.1,'#000'] //0.1透明度的背景
	        	});
				var oldData =  table.cache["productAddTable"];
				var data = oldData.filter(function(item){
					 var re = /^[1-9]\d*$/ ;
				     return item.quantity == "" || item.quantity == 0 || item.quantity == undefined || !re.test(item.quantity); 
				})
				if(oldData.length == 0){
					toastr.warning("请添加详情！");
				}else if(data.length > 0){
					toastr.warning("有"+data.length+"条数据不正确,请输入正确的数量(大于0的正整数)");
				}else{
					var wid = new Array()
					var quantity = new Array()
					for (var i = 0; i < oldData.length; i++) {
						wid.push(oldData[i].materiel.id)
						quantity.push(oldData[i].quantity)
					}
					var formData = $("#addFormID").serialize()
								+"&"+"wid="+wid
								+"&"+"quantity="+quantity;
					var title = "新增";
					var url = '${pageContext.request.contextPath}/bom/insert.do';
					var id = $.trim($("#id").val());
					if(id != "" && id != null && id != 'undefined'){
						var url = '${pageContext.request.contextPath}/bom/update.do';
						title = "修改";
					}
					$.ajax({
						url : url,
						data: formData,
						cache : false,
						type : "post",
						success: function (data) {
		                    if (data >= 1) {
		                        toastr.success(title+'成功');
		                        setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
		                            window.location.reload();
		                            $("#reset").click();
		                        },1000);
		                    } else {
		                        toastr.error(title+'失败');
		                    }
		                },
					})
				}
				layer.close(index);
				return false;
			});

			

			/**
			 * 新增表单校验
			 */
			form.verify({
				//value：表单的值、item：表单的DOM对象
	            required: function(value, item){
	            	value = $.trim(value)
	            	if(value == '' || value == null){
	                    return '不能为空';
	                }
	            },
				//value：表单的值、item：表单的DOM对象
	            only: function(value, item){
	            	value = $.trim(value)
	            	if(value == '' || value == null){
	                    return '不能为空';
	                }else{
	                    var flg = false;
	                    $.ajax({
	                        type:'post',
	                        data:'productId='+value,
	                        url:'${pageContext.request.contextPath}/bom/queryAllByMution.do',
	                        dataType: 'JSON',
	                        async: false,
	                        success:function (data) {
	                            if(data.length == 0){
	                                flg  = true;
	                            }else if(data.length == 1){
	                                var ma = $.trim($("#id").val());
	                                if (ma == data[0].id) {
	                                    flg  = true;
	                                }else{
	                                    flg = false;
	                                }
	                            }else{
	                                flg = false;
	                            }
	
	                        }
	                    });
	                    if(!flg){
	                        return '发货计划号不能重复';
	                    }
	                }
	            }
			});

			laydate.render({
                elem: '#date1'
            });
			
			//增加
            $("#add").click(function(){
                layer.open({
                    type: 1 					//Page层类型
                    ,area: ['1200px', '640px'] 	//宽  高
                    ,title: '新增'
                    ,shade: 0.6 				//遮罩透明度
                    ,maxmin: true 				//允许全屏最小化
                    ,anim: 1 					//0-6的动画形式，-1不开启
                    ,content: $('#addDivID')
                    ,end: function () {
                        var formDiv = document.getElementById('addDivID');
                        formDiv.style.display = '';
                    }
                    ,success: function(){
                    	$("#id").val("")
	                    $("#productId").val("")
	                    $("#version").val("")
                    	
                    	table.reload('productAddTable',{
        	            	data : new Array()
        	            });
                        form.render();
                    }
                });
			});

			

          	//批量删除
			$("#dels").click(function(){
				var checkStatus = table.checkStatus('tableList')
	      		var data = checkStatus.data;
	            var idArr = new Array();
	            if(data.length==0){
	                toastr.warning("请至少选择一条记录！");
	            }else{
	            	
	                var names = "";
	                var ids = "";
	                for(var i=0;i<data.length;i++){
	                    if(ids == ""){
	                        ids += data[i].id;
	                    }else{
		                        ids += "," + data[i].id;
	                    }
	                }
	                
	                
	                layer.confirm(names+'确定删除吗？', function(index){
	                    $.ajax({
	                        type:'post',
	                        url:'${pageContext.request.contextPath }/bom/delete.do',
	                        data:{"ids":ids},
	                        success:function(data){
	                            if(data>0){
	                                toastr.success("删除成功！");
	                                setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
	                                    //关闭模态框
	                                    // 父页面刷新
	                                    window.location.reload();
	                                },2000);
	                            }else{
	                                toastr.warning("删除失败！");
	                            }
	                        }

	                    })
	                    layer.closeAll();
	                });
	            }
			});
			
			  
		});
		
		var productIndex;
		function addProduct (){
			
				productIndex = layer.open({
	                type: 1 		//Page层类型
	                ,area: ['900px', '500px'] //宽  高
	                ,title: '物料清单'
	                ,shade: 0.2 	//遮罩透明度
	                ,maxmin: true //允许全屏最小化
	                ,anim: 1 		//0-6的动画形式，-1不开启
	                ,content: $('#productDiv')
	                ,end: function () {
	                    var formDiv = document.getElementById('productDiv');
	                    formDiv.style.display = '';
	                }
	                ,success: function () {
	                    table.render({
	                        elem: '#productTable'
	                        ,url:'${pageContext.request.contextPath }/materiel/queryMaterielCriteria.do'
	                        ,limits:[10,20,30]
	                        ,defaultToolbar:['filter', 'print']
	        	            ,cols: [
	        		                [{
	        		                    type: 'checkbox',
	        		                    fixed: 'left'
	        		                }, {
	        		                	field:'id',
	        		                	title:'序号', 
	        		                	sort: true,
	        		                	width: 60,
	        		                	type:'numbers',
	        		                	align:'center'
	        		                }, {
	        		                    field: 'id',
	        		                    title: 'id',
	        		                    hide:true //是否初始隐藏列，默认：false。layui 2.4.0 新增
	        		                } , {
	        		                    field: 'materiel_num',
	        		                    title: 'SAP/QAD',
	        		                    align:'center',
	        	                        //edit: 'text'
	        		                } , {
	        		                    field: 'brevity_num',
	        		                    title: '简码',
	        		                    align:'center',
	        	                        //edit: 'text'
	        		                }, {
	        		                    field: 'materiel_name',
	        		                    title: '物料名称',
	        		                    align:'center',
	        	                        //edit: 'text'
	        		                }, {
	        		                    field: 'outgoing_frequency',
	        		                    title: '出库频率',
	        		                    align:'center',
	        		                }, {
	        		                    field: 'container_name',
	        		                    title: '容器名称',
	        		                    align:'center'
	        		                    //,edit: 'text'
	        		                }, {
	        		                    field: 'packing_quantity',
	        		                    title: '包装数量',
	        		                    align:'center',
	        		                    //edit: 'text'
	        		                }, {
	        		                    field: 'is_devanning',
	        		                    title: '是否拆箱',
	        		                    align:'center'
	        		                    //,edit: 'text'
        		                    	, templet: function (row){
        		                            if(row.is_devanning == '0'){
        		                                return "是";
        		                            } else {
        		                                return "否";
        		                            }
        		                        }
	        		                }, {
	        		                    field: 'barcode_type',
	        		                    title: '条码类型',
	        		                    align:'center'
	        		                    ,edit: 'text'
        		                    	,templet: function(d){
        			                    	var value = d.barcode_type;
        		           	    			if(value=="0"){
        		           	    				value = "系统码"
        		           	    			}else if(value=="1"){
        		           	    				value = "客户码1"
        		           	    			}else if(value=="2"){
        		           	    				value = "客户码2"
        		           	    			}else{
        		           	    				value = "无码"
        		           	    			}
        		           	    			return value;
        		           	    		}
	        		                }
	        		                ]
	        		               ]
	                        ,page: true
	                        ,height: 380
	                    });
	                }
	            });
			
		}
		
		toastrStyle()
	</script>
</body>
</html>
